scores = [90, 78, 20, 55, 67, 2, 56, 79, 60, 55, 55]
"""
    列表：容器
    下标，长度，切片
    :len()
    循环：
        *直接遍历
        *下标遍历
    常用操作：
        添加元素
            append:列表末尾追加一个元素
            insert:指定下标添加一个元素
            extend:合并列表
        删除元素：
            remove
            pop
            clear
             del 
        修改元素：
            指定下标进行赋值 
        查询：
            in

"""
print(scores[2])
print(len(scores))
print(scores[0:5])
print(scores[:5])
print(scores[-3:])
print(scores[::2])
print(len(scores))

sumScore = 0
for score in scores:
    print(score)
    sumScore += score
print(sumScore)

for i in range(0, len(scores)):
    print(i, scores[i])

scores.append(100)
print(scores)

scores.insert(4, 60)
print(scores)

alist = ["a", "b", "c"]
blist = ["x", "y", "z", "a"]

alist.extend(blist)
print(alist)

scores.remove(60)  # 根据值移除指定元素
print(scores)
s = scores.pop(0)  # 根据下标移除元素 并获取到该元素
print(scores)
print(s)

del scores[0]  # 根据下标移除元素
print(scores)

# scores.clear()
# print(scores)
scores[3] = 88
print(scores)

if 56 in scores:
    print("56存在")

print(scores.index(88))
print(scores.count(55))

# 排序
scores.sort(reverse=True)
print(scores)
# 反转字符串
scores.reverse()
print(scores)

allNames = [["张三", "李四", "王五"], ["小黑", "小白"], ["如花", "小强", "鬼见愁", "鬼脚七"]]
i = 1
for c in allNames:
    print("第{}班有{}人".format(i, len(c)))
    for s in c:
        print(s)
    i += 1

# 编程实现一个元素全为数字的列表，求最大值、最小值
print(scores[0])
print(scores[-1])

scores2 = [111, 23, 2, 56, 79, 60, 55, 55]
min = scores2[0]
max = scores2[0]
for s in scores2:
    if s > max:
        max = s
    if s < min:
        min = s

print(max, min)